/*
*Copyright 2021-2023 NERCIS
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/

package cn.ac.nercis.pes.repository.model.project;

import cn.ac.nercis.pes.common.utils.JsonUtils;
import cn.ac.nercis.pes.common.constant.knowledge.TargetLevel;
import cn.ac.nercis.pes.common.constant.knowledge.TargetType;
import cn.ac.nercis.pes.common.constant.project.SpecialType;
import cn.ac.nercis.pes.repository.constant.BaseConstants;
import cn.ac.nercis.pes.repository.converter.knowledge.TargetLevelConverter;
import cn.ac.nercis.pes.repository.converter.knowledge.TargetTypeConverter;
import cn.ac.nercis.pes.repository.converter.project.SpecialTypeConverter;
import cn.ac.nercis.pes.repository.model.base.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.GenericGenerator;


/**
 * 系统特殊指标信息实体类
 * @author zpy
 * @version 1.0.0
 */
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "pes_system_special_target")
public class SystemSpecialTargetDO extends BaseEntity {
    @Id
    @GenericGenerator(name = "generator",strategy = BaseConstants.CUSTOM_UUID_STRATEGY)
    @GeneratedValue(generator = "generator")
    @Column(name = "id",unique = true,nullable = false,length = 36)
    private String id;

    @Column(name = "system_id",length = 36,nullable = false)
    private String systemId;

    @Column(name = "name",nullable = false,length = 500)
    private String name;
    @Convert(converter = SpecialTypeConverter.class)
    @Column(name = "special_type",nullable = false)
    private SpecialType specialType;

    @Column(name = "target_desc",length = 500)
    private String targetDesc;
    @Column(name = "reasons",length = 500)
    private String reasons;
    @Column(name = "layer_target_id",length = 36)
    private String layerTargetId;
    @Column(name = "sort")
    private Integer sort;

    @Column(name = "km_target_id",length = 36)
    private String kmTargetId;
    @Column(name = "km_apply_claim")
    private String kmApplyClaim;
    @Column(name = "km_deepness")
    private Integer kmDeepness;
    @Column(name = "km_is_special")
    private Boolean kmIsSpecial;
    @Column(name = "km_score")
    private Float kmScore;
    @Convert(converter = TargetLevelConverter.class)
    @Column(name = "km_level",nullable = false)
    private TargetLevel kmLevel;
    @Convert(converter = TargetTypeConverter.class)
    @Column(name = "km_type",nullable = false)
    private TargetType kmType;
    @Column(name = "km_weight")
    private Integer kmWeight;

    @Override
    public String toString() {
        return this.getClass().getSimpleName().concat(JsonUtils.toJson(this));
    }
}